let path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  mode: 'development', // 开发模式
  entry: './src/main.js',
  output:{
    filename: 'bundle.js',
    path: path.join(__dirname, './dist')
  },
  devServer: {
    port: 3106,
    progress:true,//进度条
    compress:true,//Gzip压缩
    contentBase: './dist'

  },
  module:{
    rules:[
      {
        test:/\.js$/,
        use:[
          {
            loader: 'babel-loader',
            options:{
              presets: ['@babel/preset-env'],
              plugins:[
                '@babel/plugin-transform-runtime'
              ]
            }
          }
        ],
        include: path.join(__dirname, './src'),
        exclude:/node_modules/
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './index.html',
      filename: 'index.html',
      minify:{
        removeAttributeQuotes: true, // 双引号就没了
        collapseWhitespace:true// 单行
      }
    })
  ]
};
